﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Entities
{
    [Serializable]
    public class ScheduleDetail
    {
        private int scheduleID;
        private int fromStation;
        private int toStation;
        private DateTime fromTime;
        private DateTime toTime;
        public ScheduleDetail()
        { }
        public ScheduleDetail(int scheduleID, int fromStation, int toStation, DateTime fromTime, DateTime toTime)
        {
            this.scheduleID = scheduleID;
            this.fromStation = fromStation;
            this.toStation = toStation;
            this.fromTime = fromTime;
            this.toTime = toTime;
        }
        public int ScheduleID
        {
            get { return this.scheduleID; }
            set
            {
                if (value < 0)
                    throw new Exception("scheduleID not allow nullvalue.");
                this.scheduleID = value;
            }
        }
        public int FromStation
        {
            get { return this.fromStation; }
            set
            {
                if (value < 0)
                    throw new Exception("fromStation not allow nullvalue.");
                this.fromStation = value;
            }
        }
        public int ToStation
        {
            get { return this.toStation; }
            set
            {
                if (value < 0)
                    throw new Exception("toStation not allow nullvalue.");
                this.toStation = value;
            }
        }
        public DateTime FromTime
        {
            get { return this.fromTime; }
            set { this.fromTime = value; }
        }
        public DateTime ToTime
        {
            get { return this.toTime; }
            set { this.toTime = value; }
        }
        public override string ToString()
        {
            return this.scheduleID + "; " + this.fromStation + "; " + this.toStation + "; " + this.fromTime + "; " + this.toTime + "; ";
        }
        public override bool Equals(Object obj)
        {
            ScheduleDetail me = (ScheduleDetail)obj;
            bool ret = this.ScheduleID.Equals(me.ScheduleID) && this.FromStation.Equals(me.FromStation) && this.ToStation.Equals(me.ToStation);
            return ret;
        }
        public override int GetHashCode()
        {
            return this.ScheduleID.GetHashCode() + this.FromStation.GetHashCode() + this.ToStation.GetHashCode();
        }

    }
}
